<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
	<script type="text/javascript">
		$(document).ready(function() {
			$('#formAprovaCh\\:dtPrev_input').mask('99/99/99');
		});
	</script>
</h:head>
<h:body>

	<p:dialog header="#{message.header_altera_pedido}" appendToBody="true"
		modal="true" id="dlgEditaPedido" width="950"
		widgetVar="dlgEditaPedido">
		<h:form id="formEditaPedido">
			<p:dataTable var="produto" emptyMessage="#{message.msg_semvalores}"
				value="#{consultaPedidoTela.listaProdutosEditar}" editable="true">

				<p:column headerText="#{message.produto_produto}">
					<h:outputText id="outProd" value="#{produto.codigo}" />
					<p:tooltip for="outProd" value="#{produto.descricao}"
						showEffect="fade" hideEffect="fade" />
				</p:column>

				<p:column headerText="#{message.produto_dt_necessidade2}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{produto.necessidade}">
								<f:convertDateTime pattern="dd/MM/yy" />
							</h:outputText>
						</f:facet>
						<f:facet name="input">
							<p:calendar onfocus="$(this).mask('99/99/99');" size="5"
								pattern="dd/MM/yy" locale="pt" value="#{produto.necessidade}"
								showOn="button" style="font-size: 13px;" />
						</f:facet>
					</p:cellEditor>
				</p:column>

				<p:column headerText="#{message.produto_qtde}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{produto.quantidade}">
								<f:convertNumber pattern="#,##0.000"></f:convertNumber>
							</h:outputText>
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{produto.quantidade}" size="6">
								<f:convertNumber pattern="#,##0.00"></f:convertNumber>
								<p:ajax update="totalItemPed" event="blur" />
							</p:inputText>
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="#{message.label_preco}">
					<h:outputText value="#{produto.preco}">
						<f:convertNumber pattern="#,##0.00"></f:convertNumber>
					</h:outputText>
				</p:column>
				<p:column headerText="#{message.label_ipi}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText value="#{produto.ipi}">
								<f:convertNumber pattern="##0.00"></f:convertNumber>
							</h:outputText>
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{produto.ipi}" size="1" maxlength="5">
								<f:convertNumber pattern="##0.00"></f:convertNumber>
								<f:validateDoubleRange minimum = "0.00" maximum = "100.00"/>
								<p:ajax update="totalItemPed" event="blur" />
							</p:inputText>
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="#{message.label_icms}">
					<p:cellEditor>
						<f:facet name="output">
							<h:outputText
								value="#{produto.icms}">
								<f:convertNumber pattern="##0.00"></f:convertNumber>
							</h:outputText>
						</f:facet>
						<f:facet name="input">
							<p:inputText value="#{produto.icms}" size="1" maxlength="5">
								<f:convertNumber pattern="##0.00"></f:convertNumber>
								 <f:validateDoubleRange minimum = "0.00" maximum = "100.00"/>
								<p:ajax update="totalItemPed" event="blur" />
							</p:inputText>
						</f:facet>
					</p:cellEditor>
				</p:column>
				<p:column headerText="#{message.label_total}">
					<h:outputText id="totalItemPed"
						value="#{geraPedidoTela.formataNumero((produto.preco+produto.preco*((produto.ipi+produto.icms)/100))*produto.quantidade,'#.##')}" />
				</p:column>
				<p:column>
					<p:rowEditor />
				</p:column>
				<f:facet name="footer">
					<p:commandButton value="#{message.botao_concluir} Alterações" update=":dlgErroPedido2,:formConsuPed,:messages"
						icon="ui-icon-check" action="#{consultaPedidoTela.alteraPedido}" />
				</f:facet>
			</p:dataTable>
		</h:form>
	</p:dialog>
	
		<!-- 
		##############################################################################################################################
		
														MODELPANEL ERRO MICROSIGA
		
		##############################################################################################################################
	-->

	<p:dialog header="#{message.msg_header_aviso}"
		widgetVar="dlgErroPedido2" id="dlgErroPedido2" height="350" width="550"
		resizable="false" showEffect="fadein" style="font-size: 18px;"
		appendToBody="true" modal="true">
		<div style="font-size: 13px;">
			<p:inputTextarea style="width:480px; height:280 "
				value="#{consultaPedidoTela.numPedido}" readonly="true" />
		</div>
	</p:dialog>

</h:body>
</html>
